package cn.zcy.beans;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @ConfigurationProperties(prefix ="user") 作用：常用于bean属性和yaml配置文件绑定
 * prefix：可以指定配置文件中的某个节点，该节点中的子节点将自动和bean属性进行绑定
 */
@Component
@ConfigurationProperties(prefix ="user")
public class User {

//    @Value("${username}")
    private String username;
//    @Value("${age}")
    private Integer age;

    private Date birthday;

    private List<String> hobbies;

    private Map<Integer, String> girlFirend;

    private Address address;

    @Override
    public String toString() {
        return "User{" +
                "username='" + username + '\'' +
                ", age=" + age +
                ", birthday=" + birthday +
                ", hobbies=" + hobbies +
                ", girlFirend=" + girlFirend +
                ", address=" + address +
                '}';
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public List<String> getHobbies() {
        return hobbies;
    }

    public void setHobbies(List<String> hobbies) {
        this.hobbies = hobbies;
    }

    public Map<Integer, String> getGirlFirend() {
        return girlFirend;
    }

    public void setGirlFirend(Map<Integer, String> girlFirend) {
        this.girlFirend = girlFirend;
    }

    public Address getAddress() {
        return address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }
}
